﻿using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using System.Text;
using Maticsoft.Common;
 
namespace StuEdu.Web.StuScored
{
    public partial class Add : Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {
                       
        }

        		protected void btnSave_Click(object sender, EventArgs e)
		{
			
			string strErr="";
			if(!PageValidate.IsNumber(txtsubjectId.Text))
			{
				strErr+="subjectId格式错误！\\n";	
			}
			if(!PageValidate.IsDecimal(txtstuScore.Text))
			{
				strErr+="stuScore格式错误！\\n";	
			}
			if(this.txtstate.Text.Trim().Length==0)
			{
				strErr+="state不能为空！\\n";	
			}
			if(!PageValidate.IsNumber(txtstuNo.Text))
			{
				strErr+="stuNo格式错误！\\n";	
			}

			if(strErr!="")
			{
				MessageBox.Show(this,strErr);
				return;
			}
			int subjectId=int.Parse(this.txtsubjectId.Text);
			decimal stuScore=decimal.Parse(this.txtstuScore.Text);
			string state=this.txtstate.Text;
			int stuNo=int.Parse(this.txtstuNo.Text);

			StuEdu.Model.StuScored model=new StuEdu.Model.StuScored();
			model.subjectId=subjectId;
			model.stuScore=stuScore;
			model.state=state;
			model.stuNo=stuNo;

			StuEdu.BLL.StuScored bll=new StuEdu.BLL.StuScored();
			bll.Add(model);
			Maticsoft.Common.MessageBox.ShowAndRedirect(this,"保存成功！","add.aspx");

		}


        public void btnCancle_Click(object sender, EventArgs e)
        {
            Response.Redirect("list.aspx");
        }
    }
}
